package com.liuhuanss.voiceprint.entity;

import com.baomidou.mybatisplus.annotation.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户实体类
 * 
 * @author liuhuanss
 * @version 1.0
 */
@TableName("users")
@Data
public class User implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 50, message = "用户名长度必须在3-50个字符之间")
    @TableField("username")
    private String username;

    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    @TableField("email")
    private String email;

    @NotBlank(message = "密码不能为空")
    @Size(min = 6, message = "密码长度不能少于6个字符")
    @TableField("password")
    private String password;

    @TableField("voiceprint_feature_id")
    private String voiceprintFeatureId;

    @TableField("voiceprint_group_id")
    private String voiceprintGroupId;

    @TableField("is_voiceprint_enabled")
    private Integer isVoiceprintEnabled = 1;

    @TableField("is_active")
    private Integer isActive = 1;

    @TableLogic
    @TableField("deleted")
    private Integer deleted = 0;

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;


}